package com.huawei.appgallery.forum.cards.widget;

import android.content.Context;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView.LayoutParams;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import java.util.List;
import o.azb;
import o.bsy.b;
import o.bsy.e;

public class SpinnerAdapter extends ArrayAdapter<String> {
    private boolean isFromBuoy = false;
    private boolean isImmer = false;
    private Context mContext;
    private int textColor;

    static class d {
        private TextView ˊ;

        private d() {
        }
    }

    public boolean isImmer() {
        return this.isImmer;
    }

    public void setImmer(boolean z) {
        this.isImmer = z;
    }

    public int getTextColor() {
        return this.textColor;
    }

    public void setTextColor(int i) {
        this.textColor = i;
    }

    public SpinnerAdapter(@NonNull Context context, @NonNull List<String> list) {
        super(context, b.ʼॱ, list);
        this.mContext = context;
    }

    public boolean isFromBuoy() {
        return this.isFromBuoy;
    }

    public void setFromBuoy(boolean z) {
        this.isFromBuoy = z;
    }

    public View getDropDownView(int i, @Nullable View view, @NonNull ViewGroup viewGroup) {
        String str = (String) getItem(i);
        View inflate = LayoutInflater.from(this.mContext).inflate(b.ˈ, null);
        TextView textView = (TextView) inflate.findViewById(16908308);
        textView.setLayoutParams(new LayoutParams(-1, this.mContext.getResources().getDimensionPixelSize(e.ᐝ)));
        textView.setText(str);
        if (isFromBuoy()) {
            textView.setTextColor(Color.argb(168, 255, 255, 255));
        }
        return inflate;
    }

    @NonNull
    public View getView(int i, @Nullable View view, @NonNull ViewGroup viewGroup) {
        d dVar;
        String str = (String) getItem(i);
        if (view == null || !(view.getTag() instanceof d)) {
            view = LayoutInflater.from(this.mContext).inflate(b.ʼॱ, null);
            d dVar2 = new d();
            dVar2.ˊ = (TextView) view.findViewById(16908308);
            dVar2.ˊ.setPadding(0, 0, 0, 0);
            view.setTag(dVar2);
            dVar2.ˊ.setMaxWidth(azb.ॱ(this.mContext) / 3);
            dVar = dVar2;
        } else {
            dVar = (d) view.getTag();
        }
        dVar.ˊ.setText(str);
        if (this.isImmer) {
            dVar.ˊ.setTextColor(this.textColor);
        }
        return view;
    }
}
